#include <iostream>
using namespace std;

char* insertstr(char *output, const char *input,char *insertstr, int index)
{
	int inputlen=0;
	int insertlen=0;
	int count=0;
	const char *str_input=input;
	const char *str_insert=insertstr;
	while(*str_input!='\0')
	{
		inputlen++;
		str_input++;
	}
	while(*str_insert!='\0')
	{
		insertlen++;
		str_insert++;
	}
	output=new char[inputlen+insertlen+1];
	if (index>inputlen)
	{
		return NULL;
	}
	for (int i=0;i<index;i++)
	{
		output[count++]=input[i];
	}
	for (int i=0;i<insertlen;i++)
	{
		output[count++]=insertstr[i];
	}
	for (int i=index;i<inputlen;i++)
	{
		output[count++]=input[i];
	}
	output[count]='\0';
	return output;
    //cout<<output<<endl;
}

int main()
{
	//char a[]="abcdefg";
	//char *b=NULL;
	//char c[]="abc";
	//int index=3;
	//cout<<insertstr(b,a,c,3)<<endl;;
	//cout<<b<<endl;

	return 0;
}